<?php

namespace App\Models;

use Hyn\Tenancy\Traits\UsesTenantConnection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\Models\AssetStockChangeHistory
 *
 * @property int $id
 * @property int $action_id
 * @property int $asset_stock_id
 * @property string|null $comment
 * @property int $quantity
 * @property int $user_id
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property-read \App\Models\AssetStockChangeHistoryAction $action
 * @property-read \App\Models\AssetStock $assetStock
 * @property-read \App\Models\User $user
 * @method static bool|null forceDelete()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory newQuery()
 * @method static \Illuminate\Database\Query\Builder|\App\Models\AssetStockChangeHistory onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory query()
 * @method static bool|null restore()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory whereActionId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory whereAssetStockId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory whereComment($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory whereQuantity($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetStockChangeHistory whereUserId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\AssetStockChangeHistory withTrashed()
 * @method static \Illuminate\Database\Query\Builder|\App\Models\AssetStockChangeHistory withoutTrashed()
 * @mixin \Eloquent
 */
class AssetStockChangeHistory extends Model
{
    use SoftDeletes, UsesTenantConnection;
    protected $guarded = [];
    protected $with = ['action', 'user'];

    public function action()
    {
        return $this->belongsTo(AssetStockChangeHistoryAction::class, 'action_id');
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function assetStock()
    {
        return $this->belongsTo(AssetStock::class, 'asset_stock_id');
    }
}
